home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / g_quake / bort22.zip / HOLO.QC < prev    next >
Text File  |  1996-10-09  |  5KB  |  153 lines

  1. //====================================================================
  2. //
  3. // HOLOGRAPHIC SELF            by: Perecli Manole AKA Bort
  4. //
  5. //====================================================================
  6. // Aside from this new file, the following are the modifications
  7. // done to id's original source files:
  8. //--------------------------------------------------------------------
  9. // File: Progs.src
  10. // Location: before the "weapons.qc" line
  11. // Added: holo.qc
  12. //--------------------------------------------------------------------
  13. // File: Weapons.qc
  14. // Procedure: ImpulseCommands
  15. // Location: in the beginning of the function
  16. // Added: CheckHoloCommand ();
  17. //--------------------------------------------------------------------
  18. // File: Client.qc
  19. // Procedure: SetChangeParms
  20. // Location: in "// remove items" between "IT_QUAD" and ")"
  21. // Added: | IT_HOLO
  22. //--------------------------------------------------------------------
  23. // File: Defs.qc
  24. // Declaration group: Item definitions
  25. // Location: after line float IT_QUAD = 4194304;
  26. // Added: float    IT_HOLO = 8388608;
  27. //--------------------------------------------------------------------
  28. // File: Client.qc
  29. // Procedure: ClientConnect
  30. // Location: next line after bprint (" entered the game\n");
  31. // Added: centerprint("This server supports: ...bla.bla.bla..");
  32. //--------------------------------------------------------------------
  33.  
  34.  
  35. float ACTIVATE_HOLO = 99;    // impulse constant
  36. float SEC = 10;            // number of seconds holo is on
  37. float COST = 10;        // number of power cells holo costs
  38. float CHANCE = 0.7;        // frequency of holo shooting (1.0 = continuous)
  39.  
  40.  
  41. //--------------------------------------------------------------------
  42. // When time expires holograph gets deactivated
  43. //--------------------------------------------------------------------
  44. void() RemoveHolo =
  45. {
  46.     WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  47.     WriteByte (MSG_BROADCAST, TE_TELEPORT);
  48.     WriteCoord (MSG_BROADCAST, self.origin_x);
  49.     WriteCoord (MSG_BROADCAST, self.origin_y);
  50.     WriteCoord (MSG_BROADCAST, self.origin_z);
  51.     sound (self, CHAN_BODY, "misc/r_tele1.wav", 1, ATTN_NORM);
  52.     SUB_Remove();
  53.     self.owner.items = self.owner.items - IT_HOLO;
  54.     sprint(self.owner,"holograph expired\n");
  55. };
  56.  
  57.  
  58. //--------------------------------------------------------------------
  59. // Frames for holograph self
  60. //--------------------------------------------------------------------
  61. void() holo_stand;        // prototype
  62.  
  63. void() holo_shoot1 = [103, holo_shoot2]
  64. {
  65.     sound (self ,CHAN_WEAPON, "weapons/spike2.wav", 1, ATTN_NORM);
  66.     self.effects = self.effects | EF_MUZZLEFLASH;
  67. };  
  68.  
  69. void() holo_shoot2 = 
  70. {
  71.     self.frame = 104;
  72.     if (random() <= CHANCE)
  73.     {
  74.         sound (self ,CHAN_WEAPON, "weapons/spike2.wav", 1, ATTN_NORM);
  75.         self.effects = self.effects | EF_MUZZLEFLASH;
  76.     }
  77.     self.nextthink = time + 0.1;
  78.     if (random() > CHANCE)
  79.         self.think = holo_stand;
  80.     else
  81.         self.think = holo_shoot1;
  82.     self.health = self.health - 0.2;
  83.     if (self.health <= 0)    
  84.         RemoveHolo();    
  85. };
  86.  
  87. void() holo_stand  = 
  88. {
  89.     self.frame = 105;
  90.     if (random() > CHANCE)
  91.         self.think = holo_stand;
  92.     else
  93.         self.think = holo_shoot1;
  94.     self.nextthink = time + 0.1;    
  95.     self.health = self.health - 0.1;
  96.     if (self.health <= 0)    
  97.         RemoveHolo();    
  98. };
  99.  
  100.  
  101.  
  102. //--------------------------------------------------------------------
  103. // Spawns holograph self
  104. //--------------------------------------------------------------------
  105. void(entity myself) ActivateHolo =
  106. {
  107.     local entity    newholo;
  108.  
  109.     newholo = spawn();
  110.     newholo.solid = SOLID_NOT;
  111.     newholo.movetype = MOVETYPE_TOSS;
  112.     setmodel (newholo, "progs/player.mdl");
  113.     setorigin (newholo, myself.origin);
  114.     setsize (newholo, VEC_HULL_MIN, VEC_HULL_MAX);
  115.     newholo.classname = "holo";
  116.     newholo.angles = myself.angles;
  117.     newholo.velocity = self.velocity + '0 0 200';
  118.     newholo.colormap = myself.colormap;
  119.     newholo.skin = myself.skin;
  120.     newholo.owner=myself;
  121.     newholo.health = SEC;
  122.     myself.currentammo = myself.ammo_cells = myself.ammo_cells - COST;
  123.     myself.items = myself.items | IT_HOLO;
  124.     stuffcmd (newholo.owner, "bf\n");
  125.     sprint(newholo.owner,"holograph activated\n");
  126.     newholo.nextthink = time;    
  127.     newholo.think = holo_stand;    
  128. };
  129.  
  130.  
  131.  
  132. //--------------------------------------------------------------------
  133. // Checks if holograph should be activated
  134. //--------------------------------------------------------------------
  135. void() CheckHoloCommand = 
  136. {
  137.     if (self.impulse != ACTIVATE_HOLO )
  138.         return;
  139.  
  140.     if ((self.items & IT_HOLO) == IT_HOLO)
  141.     {
  142.         sprint(self,"holograph active\n");
  143.         return;
  144.     }
  145.  
  146.     if (self.ammo_cells < COST)
  147.     {
  148.         sprint(self,"cells are low\n");
  149.         return;
  150.     }
  151.     
  152.     ActivateHolo (self);
  153. };